﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace HotelManagerDAL2
{
    public class HotelDbContext
    {
        public HotelDbContext()
        {
        }

        public HotelDbContext(DbContextOptions options) : base(options)
        {
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            var folder = Environment.SpecialFolder.LocalApplicationData;
            var path = Environment.GetFolderPath(folder);
            var DbPath = Path.Join(path, "database.db3");
            // 如果没有配置数据库连接字符串，这里就需要配置数据库连接串
            // 否则，就没有必要配置SQLite数据库了
            optionsBuilder.UseSqlite($"Data Source={DbPath}");
        }
    }
}
